import java.util.PriorityQueue;

public class test {
    public static void main(String[] args) {
        Heap heap = new Heap();
        int[] array = {27,15,19,18,28,34,65,49,25,37};

        int[] ret = heap.topk1(array,4);
        for (int i = 0; i < ret.length; i++) {
            System.out.print(ret[i] + " ");
        }

        System.out.println();
        System.out.println("====================");
        ret = heap.topk2(array,4);
        for (int i = 0; i < ret.length; i++) {
            System.out.print(ret[i] + " ");
        }

    }
    public static void main1(String[] args) {
        Heap heap = new Heap();
        int[] array = {27,15,19,18,28,34,65,49,25,37};
        //建堆方式一：先初始化，再向下调整建堆
        heap.initHeap(array);
        heap.creatHeap();


        //建堆方式二：依次offer，向上调整建堆
//        for (int i = 0; i < array.length; i++) {
//            heap.offer(array[i]);
//        }

        heap.heapsort();



    }
}
